<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
          document.domain = "jsplusplus.com"
          myIframe = document.createElement('iframe');
          myIframe.id = "myiframe";
          myIframe.src = "http://test.jsplusplus.com";

          myIframe.onload = function(){
            var XMLHTTP = document.getElementById('myiframe').contentWindow.XMLHTTPRequest;
                    var xhr = new XMLHTTP();
                        xhr.open('POST','http://test.jsplusplus.com/getCourses');
                        xhr.onreadyStateChange = function(){
                            if(xhr.ready==4 && xhr.status=='200' || xhr.status<300){
                                var data = xhr.responseText;
                                 console.log(data);
                            }
                        }
                        xhr.send({field:1,name:2});

          }

          document.body.appendChild(myIframe);
    </script>
</body>
</html>